using System;
using System.Data;
using System.ComponentModel;
using System.Reflection;
using System.Collections.Generic;
using DataObject.Helpers;

namespace DataObject.Model
{
    [Serializable]
    public class ReservationServiceDTO : DTOBase
    {
        #region Properties
        /// <summary>
        /// Status name is displayed
        /// </summary>
        public string StatusN
        {
            get
            {
                return define.Status[Status];
            }
        }

        /// <summary>
        /// Currency text is displayed
        /// </summary>
        public string CurrencyN
        {
            get
            {
                return ((CurrencyEnum)Currency).GetStringValue();
            }
        }

        /// <summary>
        /// Service type is displayed.
        /// </summary>
        public string ServiceTypeN
        {
            get
            {
                return define.Services[ServiceType];
            }
        }

        protected void OnServiceTypeChanged()
        {
            ServiceType = ServiceType > 2 ? 2 : ServiceType;
        }
        #endregion

        #region Constructors & destructors
        public ReservationServiceDTO()
        {
            ReservationServiceID = Helper.NewSeqGuid();
            ModifiedDate = DateTime.Now;
        }
        #endregion

        #region Reference property Members

        private ProviderDTO _provider = new ProviderDTO();
        public ProviderDTO Provider
        {
            get
            {
                return _provider;
            }
            set
            {
                if (_provider != value)
                {
                    _provider = value;
                }
            }
        }
        private ReservationDTO _reservation = new ReservationDTO();
        public ReservationDTO Reservation
        {
            get
            {
                return _reservation;
            }
            set
            {
                if (_reservation != value)
                {
                    _reservation = value;
                }
            }
        }
        private ServiceDTO _service = new ServiceDTO();
        public ServiceDTO Service
        {
            get
            {
                return _service;
            }
            set
            {
                if (_service != value)
                {
                    _service = value;
                }
            }
        }

        #endregion

        #region Collection Members


        #endregion

        #region Property Active

        private bool _active;

        /// <summary>
        ///  Property Active
        /// <summary>
        public bool Active
        {
            get
            {
                return _active;
            }

            set
            {
                if (_active != value)
                {
                    this.OnActiveChanging(value);
                    _active = value;
                    this.OnActiveChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property Unit

        private int _unit;

        /// <summary>
        ///  Property Unit
        /// <summary>
        public int Unit
        {
            get
            {
                return _unit;
            }

            set
            {
                if (_unit != value)
                {
                    this.OnUnitChanging(value);
                    _unit = value;
                    this.OnUnitChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property NumInPackage

        private int _numInPackage;

        /// <summary>
        ///  Property NumInPackage
        /// <summary>
        public int NumInPackage
        {
            get
            {
                return _numInPackage;
            }

            set
            {
                if (_numInPackage != value)
                {
                    this.OnNumInPackageChanging(value);
                    _numInPackage = value;
                    this.OnNumInPackageChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property NightFlag

        private bool _nightFlag;

        /// <summary>
        ///  Property NightFlag
        /// <summary>
        public bool NightFlag
        {
            get
            {
                return _nightFlag;
            }

            set
            {
                if (_nightFlag != value)
                {
                    this.OnNightFlagChanging(value);
                    _nightFlag = value;
                    this.OnNightFlagChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property UnitPrice

        private decimal _unitPrice;

        /// <summary>
        ///  Property UnitPrice
        /// <summary>
        public decimal UnitPrice
        {
            get
            {
                return _unitPrice;
            }

            set
            {
                if (_unitPrice != value)
                {
                    this.OnUnitPriceChanging(value);
                    _unitPrice = value;
                    this.OnUnitPriceChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property Amount

        private decimal _amount;

        /// <summary>
        ///  Property Amount
        /// <summary>
        public decimal Amount
        {
            get
            {
                return _amount;
            }

            set
            {
                if (_amount != value)
                {
                    this.OnAmountChanging(value);
                    _amount = value;
                    this.OnAmountChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property Currency

        private int _currency;

        /// <summary>
        ///  Property Currency
        /// <summary>
        public int Currency
        {
            get
            {
                return _currency;
            }

            set
            {
                if (_currency != value)
                {
                    this.OnCurrencyChanging(value);
                    _currency = value;
                    this.OnCurrencyChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property Date

        private DateTime _date;

        /// <summary>
        ///  Property Date
        /// <summary>
        public DateTime Date
        {
            get
            {
                return _date;
            }

            set
            {
                if (_date != value)
                {
                    this.OnDateChanging(value);
                    _date = value;
                    this.OnDateChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ServiceDate

        private DateTime? _serviceDate;

        /// <summary>
        ///  Property ServiceDate
        /// <summary>
        public DateTime? ServiceDate
        {
            get
            {
                return _serviceDate;
            }

            set
            {
                if (_serviceDate != value)
                {
                    this.OnServiceDateChanging(value);
                    _serviceDate = value;
                    this.OnServiceDateChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property HotelPickupAddress

        private string _hotelPickupAddress;

        /// <summary>
        ///  Property HotelPickupAddress
        /// <summary>
        public string HotelPickupAddress
        {
            get
            {
                return _hotelPickupAddress;
            }

            set
            {
                if (_hotelPickupAddress != value)
                {
                    this.OnHotelPickupAddressChanging(value);
                    _hotelPickupAddress = value;
                    this.OnHotelPickupAddressChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ModifiedBy

        private string _modifiedBy;

        /// <summary>
        ///  Property ModifiedBy
        /// <summary>
        public string ModifiedBy
        {
            get
            {
                return _modifiedBy;
            }

            set
            {
                if (_modifiedBy != value)
                {
                    this.OnModifiedByChanging(value);
                    _modifiedBy = value;
                    this.OnModifiedByChanged();
                }
            }
        }

        #endregion

        #region Property ModifiedDate

        private DateTime? _modifiedDate;

        /// <summary>
        ///  Property ModifiedDate
        /// <summary>
        public DateTime? ModifiedDate
        {
            get
            {
                return _modifiedDate;
            }

            set
            {
                if (_modifiedDate != value)
                {
                    this.OnModifiedDateChanging(value);
                    _modifiedDate = value;
                    this.OnModifiedDateChanged();
                }
            }
        }

        #endregion

        #region Property Nights

        private double _nights;

        /// <summary>
        ///  Property Nights
        /// <summary>
        public double Nights
        {
            get
            {
                return _nights;
            }

            set
            {
                if (_nights != value)
                {
                    this.OnNightsChanging(value);
                    _nights = value;
                    this.OnNightsChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property OtherUom

        private string _otherUom;

        /// <summary>
        ///  Property OtherUom
        /// <summary>
        public string OtherUom
        {
            get
            {
                return _otherUom;
            }

            set
            {
                if (_otherUom != value)
                {
                    this.OnOtherUomChanging(value);
                    _otherUom = value.Trim();
                    this.OnOtherUomChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property PackagePrice

        private decimal _packagePrice;

        /// <summary>
        ///  Property PackagePrice
        /// <summary>
        public decimal PackagePrice
        {
            get
            {
                return _packagePrice;
            }

            set
            {
                if (_packagePrice != value)
                {
                    this.OnPackagePriceChanging(value);
                    _packagePrice = value;
                    this.OnPackagePriceChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property Pax

        private double _pax;

        /// <summary>
        ///  Property Pax
        /// <summary>
        public double Pax
        {
            get
            {
                return _pax;
            }

            set
            {
                if (_pax != value)
                {
                    this.OnPaxChanging(value);
                    _pax = value;
                    this.OnPaxChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property Program

        private string _program;

        /// <summary>
        ///  Property Program
        /// <summary>
        public string Program
        {
            get
            {
                return _program;
            }

            set
            {
                if (_program != value)
                {
                    this.OnProgramChanging(value);
                    _program = value;
                    this.OnProgramChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ProviderID

        private Guid? _providerID;

        /// <summary>
        ///  Property ProviderID
        /// <summary>
        public Guid? ProviderID
        {
            get
            {
                return _providerID;
            }

            set
            {
                if (_providerID != value)
                {
                    this.OnProviderIDChanging(value);
                    _providerID = value;
                    this.OnProviderIDChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property Rate

        private decimal? _rate;

        /// <summary>
        ///  Property Rate
        /// <summary>
        public decimal? Rate
        {
            get
            {
                return _rate;
            }

            set
            {
                if (_rate != value)
                {
                    this.OnRateChanging(value);
                    _rate = value;
                    this.OnRateChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ReservationID

        private Guid _reservationID;

        /// <summary>
        ///  Property ReservationID
        /// <summary>
        public Guid ReservationID
        {
            get
            {
                return _reservationID;
            }

            set
            {
                if (_reservationID != value)
                {
                    this.OnReservationIDChanging(value);
                    _reservationID = value;
                    this.OnReservationIDChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ReservationServiceID

        private Guid _reservationServiceID;

        /// <summary>
        ///  Property ReservationServiceID
        /// <summary>
        public Guid ReservationServiceID
        {
            get
            {
                return _reservationServiceID;
            }

            set
            {
                if (_reservationServiceID != value)
                {
                    this.OnReservationServiceIDChanging(value);
                    _reservationServiceID = value;
                    this.OnReservationServiceIDChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ServiceID

        private Guid? _serviceID;

        /// <summary>
        ///  Property ServiceID
        /// <summary>
        public Guid? ServiceID
        {
            get
            {
                return _serviceID;
            }

            set
            {
                if (_serviceID != value)
                {
                    this.OnServiceIDChanging(value);
                    _serviceID = value;
                    this.OnServiceIDChanged();
                    OnChanged();
                }
            }
        }

        #endregion

        #region Property ServiceType

        private int _serviceType;

        /// <summary>
        ///  Property ServiceType
        /// <summary>
        public int ServiceType
        {
            get
            {
                return _serviceType;
            }

            set
            {
                if (_serviceType != value)
                {
                    this.OnServiceTypeChanging(value);
                    _serviceType = value;
                    this.OnServiceTypeChanged();
                    OnChanged();
                }
            }
        }

        #endregion


        private int _status;
        public int Status
        {
            get { return _status; }
            set
            {
                if (_status != value)
                {
                    this.OnStatusChanging(value);
                    _status = value;
                    this.OnStatusChanged();
                    OnChanged();
                }
            }
        }

        #region Extensibility Method Declarations

        protected virtual void OnActiveChanging(bool active) { }
        protected virtual void OnActiveChanged() { }
        protected virtual void OnUnitChanging(int unit) { }
        protected virtual void OnUnitChanged() { }
        protected virtual void OnNumInPackageChanging(int numInPackage) { }
        protected virtual void OnNumInPackageChanged() { }
        protected virtual void OnNightFlagChanging(bool nightFlag) { }
        protected virtual void OnNightFlagChanged() { }
        protected virtual void OnUnitPriceChanging(decimal unitPrice) { }
        protected virtual void OnUnitPriceChanged() { }
        protected virtual void OnAmountChanging(decimal amount) { }
        protected virtual void OnAmountChanged() { }
        protected virtual void OnCurrencyChanging(int currency) { }
        protected virtual void OnCurrencyChanged() { }
        protected virtual void OnDateChanging(DateTime date) { }
        protected virtual void OnDateChanged() { }
        protected virtual void OnServiceDateChanging(DateTime? date) { }
        protected virtual void OnServiceDateChanged() { }
        protected virtual void OnHotelPickupAddressChanging(string hotelPickupAddress) { }
        protected virtual void OnHotelPickupAddressChanged() { }
        protected virtual void OnModifiedByChanging(string modifiedBy) { }
        protected virtual void OnModifiedByChanged() { }
        protected virtual void OnModifiedDateChanging(DateTime? modifiedDate) { }
        protected virtual void OnModifiedDateChanged() { }
        protected virtual void OnNightsChanging(double nights) { }
        protected virtual void OnNightsChanged() { }
        protected virtual void OnOtherUomChanging(string otherUom) { }
        protected virtual void OnOtherUomChanged() { }
        protected virtual void OnPackagePriceChanging(decimal packagePrice) { }
        protected virtual void OnPackagePriceChanged() { }
        protected virtual void OnPaxChanging(double pax) { }
        protected virtual void OnPaxChanged() { }
        protected virtual void OnProgramChanging(string program) { }
        protected virtual void OnProgramChanged() { }
        protected virtual void OnProviderIDChanging(Guid? providerID) { }
        protected virtual void OnProviderIDChanged() { }
        protected virtual void OnRateChanging(decimal? rate) { }
        protected virtual void OnRateChanged() { }
        protected virtual void OnReservationIDChanging(Guid reservationID) { }
        protected virtual void OnReservationIDChanged() { }
        protected virtual void OnReservationServiceIDChanging(Guid reservationServiceID) { }
        protected virtual void OnReservationServiceIDChanged() { }
        protected virtual void OnServiceIDChanging(Guid? serviceID) { }
        protected virtual void OnServiceIDChanged() { }
        protected virtual void OnServiceTypeChanging(int serviceType) { }
        protected virtual void OnStatusChanging(int status) { }
        protected virtual void OnStatusChanged() { }
        #endregion

    }
}
